package org.gamma.applet;

import netscape.javascript.JSObject;
//import sun.plugin.javascript.JSObject;

public abstract class GammaTask implements Runnable {
    private GammaApplet applet;
    private JSObject input;
    private JSObject output;
    private int index;

    public void run() {
    	respond(input, output);
    	applet.onReady(index);
    }
    
    protected GammaApplet getApplet() {
		return applet;
	}

	protected void setApplet(GammaApplet applet) {
		this.applet = applet;
	}

	protected JSObject getInput() {
		return input;
	}

	protected void setInput(JSObject input) {
		this.input = input;
	}

	protected JSObject getOutput() {
		return output;
	}

	protected void setOutput(JSObject output) {
		this.output = output;
	}

	protected int getIndex() {
		return index;
	}

	protected void setIndex(int index) {
		this.index = index;
	}

	/**
     * Your subclass will retrieve actionable values from input using JSObject.getMember 
     * and set response values on output using JSObject.setMember.
     * @param response
     */
    protected abstract void respond(JSObject input, JSObject output);

}
